
#ifndef EXAMPLE_MASS_SPRING_SIMULATION_TIMELINE_H
#define EXAMPLE_MASS_SPRING_SIMULATION_TIMELINE_H

#include <QtGui/QMainWindow>
#include "ui_Example_Mass_Spring_Simulation_Timeline.h"

/* Sx Library Includes */
#include <sxQOpenGL_Viewport.h>
#include <sxOpenGL_Context.h>
#include <sxFixedTimelineController.h>
#include <sxMassSpringSimulation.h>
#include <sxMassSpringSimulationController.h>
#include <sxMassSpringMesh.h>
#include <sxMassSpringSimulationRecorder.h>
#include <sxMassSpringSimulationReplayController.h>

using Sx::Simulation::Simulations::MassSpringSimulation;
using Sx::Simulation::Interface::MassSpringSimulationController;
using Sx::Simulation::Recording::MassSpringSimulationRecording;
using Sx::Simulation::Recording::MassSpringSimulationRecorder;
using Sx::Simulation::Interface::MassSpringSimulationReplayController;
using Sx::Multimedia::Interface::FixedTimelineController;
using Sx::OpenGL::Graphics::Contexts::OpenGL_Context;
using Sx::QtInterface::QOpenGL_Viewport;
using Sx::Simulation::Objects::MassSpringMesh;

class Example_Mass_Spring_Simulation_Timeline : public QMainWindow {
	Q_OBJECT

public:
	Example_Mass_Spring_Simulation_Timeline(QWidget *parent = 0, Qt::WFlags flags = 0);
	~Example_Mass_Spring_Simulation_Timeline();

public slots:
	void onStartRecording();
	void onStopRecording();
	void onPlay();
	void onPause();
	void onReset();
	void onIncrementFrame();
	void onDecrementFrame();
	
private:
	Ui::Example_Mass_Spring_Simulation_TimelineClass ui;

	/* Pointers becuase of Qt */
	QOpenGL_Viewport* openGL_Viewport0;
	QOpenGL_Viewport* openGL_Viewport1;

	/* OpenGL Viewport */
	std::shared_ptr<OpenGL_Context> openglContext;

	/* Timeline Controller */
	std::shared_ptr<FixedTimelineController> timelineController;

	/* Mass Spring System */
	std::shared_ptr<MassSpringSimulation> massSpringSimulation;
	std::shared_ptr<MassSpringSimulationController> mssController;

	/* MassSpringMesh Demo Objects */
	std::shared_ptr<MassSpringMesh> ground;
	std::shared_ptr<MassSpringMesh> object1;
	std::shared_ptr<MassSpringMesh> object2;
	std::shared_ptr<MassSpringMesh> object3;

	/* MassSpring Simulation Recording */
	std::shared_ptr<MassSpringSimulationRecording> testRecording;
	std::shared_ptr<MassSpringSimulationRecorder> mssRecorder;
	std::shared_ptr<MassSpringSimulationReplayController> replayController;
};

#endif
